package cn.zebra.dev.admin.module.admin.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.util.Objects;

/**
 * 后台角色关联(多对多)
 *
 * @author runnable
 * @date 2019-09-07 17:03:30
 */
@TableName("admin_role_item")
@Getter
@Setter
public class AdminRoleItemEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.AUTO)
    private Long id;

    @ApiModelProperty("后台用户id")
    private Long adminId;

    @ApiModelProperty("角色id")
    private Long roleId;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        AdminRoleItemEntity that = (AdminRoleItemEntity) o;
        return Objects.equals(id, that.id) &&
                Objects.equals(adminId, that.adminId) &&
                Objects.equals(roleId, that.roleId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, adminId, roleId);
    }
}
